<?php
/**
 * cdt.projects.php
 * 
 */

function retrieve_thumbnail() {
	$thumbPath = "";
	
	if(in_the_loop() || is_single()) {
		global $post;
		
		$thumbPath = get_post_meta($post->ID, "thumb-url", true);

		if(empty($thumbPath) || !file_exists(WP_CONTENT_DIR . "/uploads/" . $thumbPath)) {
			$thumbPath = get_bloginfo('template_url') . "/graphics/thumb-placeholder.jpg";
		} else {
			$thumbPath = get_bloginfo('url') . "/wp-content/uploads/" . $thumbPath;
		}
	} 
	else {
		$thumbPath = get_bloginfo('template_url') . "/graphics/preview.jpg";
	}
	
	return $thumbPath;
}

function retrieve_description() {
	$desc = "";
	
	if(is_single()) {
	 		the_post();
			$desc = get_the_excerpt();
			rewind_posts();
	 	}
	else {
		$desc = get_bloginfo('description');
	}
	
	return $desc;
}

?>